<?php
//+--------------------------------------------
//|描述 携程  redis
//|--------------------------------------------
//|Created by PhpStorm.
//| Author: DRG
//+-------------------------------------------
//|Date: 2018/6/1
//| Time: 15:01
//+--------------------------------------------

$http = new swoole_http_server('0.0.0.0','8001');

$http->on('request', function ($request, $response){
    $redis = new Swoole\Coroutine\Redis();
    
    $redis->connect('127.0.0.1',6379);
    
    $value = $redis->get($request->get['a']);
    
    $response->header("Content-Type", "text/plain");
    $response->end($value);
});

$http->start();

/**'
 * 1 获取redis数据
 * 2 获取mysql数据
 *
 * 网络时间   redis  io时间+mysql执行时间
 *
 * 如果使用携程   就是   单个的最大时间   max(redis, mysql)
 */

